// pages/testelement/testelement.js

const date = new Date()
const years = []
const months = []
const days = []

for (let i = 1990; i <= date.getFullYear(); i++) {
  years.push(i)
}

for (let i = 1; i <= 12; i++) {
  months.push(i)
}

for (let i = 1; i <= 31; i++) {
  days.push(i)
}
Page({

  /**
   * 页面的初始数据
   */
  data: {
    array: ['中国', '美国', '巴西', '日本'],
    index: 0,
    date: '2016-09-01',
    time: '12:01',
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
    indicatorDots: true,
    vertical: false,
    autoplay: false,
    interval: 2000,
    duration: 500,
    x: 30,
    y: 20,
    "videoSrc": "https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv",

    years,
    year: date.getFullYear(),
    months,
    month: 2,
    days,
    day: 2,
    value: [9999, 1, 1],
    isDaytime: true,

    pwd: "",
  },

  sliderchange(e) {
    console.log(e.detail.value);
    this.setData({
      testdata1: e.detail.value,
    });
    setTimeout(() => {
      this.setData({
        testdata1: 1,
      });
    }, 2000);
  },

  tap(e) {
    this.setData({
      testdata1: 6,
    });
    setTimeout(() => {
      this.setData({
        testdata1: 1,
      });
    }, 3000);
  },

  longpress(e) {
    this.setData({
      testdata1: 6,
    });
    setTimeout(() => {
      this.setData({
        testdata1: 1,
      });
    }, 3000);
  },

  testdelay(e) {
    setTimeout(() => {
      this.setData({ delay: true });
      setTimeout(() => {
        this.setData({
          delay: false,
        });
      }, 5000);
    }, 2000);
  },

  userNameInput(e) {
    console.log("input", e)
    this.setData({
      username: e.detail.value,
    });
  },

  textareaInput(e) {
    console.log(e.detail.value);
  },

  switchChange(e) {
    console.log(e.detail.value);
  },

  bindPickerChange(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value);
    this.setData({
      index: e.detail.value,
    });
  },

  bindDateChange(e) {
    console.log(e.detail.value);
    this.setData({
      date: e.detail.value,
    });
  },

  bindTimeChange(e) {
    console.log(e.detail.value);
    this.setData({
      time: e.detail.value,
    });
  },

  scroll(e) {
    console.log(e);
  },

  swiperChange(e) {
    console.log(e);
  },

  bindanimationfinish(e) {
    console.log("bindanimationfinish", e)
  },

  bindtransition(e) {
    console.log("bindtransition", e)
  },

  testinput(e) {
    console.log("input", e)
  },

  testfocus(e) {
    console.log("focus", e)
  },

  testblur(e) {
    console.log("blur", e)
  },

  testconfirm(e) {
    console.log("confirm", e)
  },
  formSubmit(e) {
    console.log("submit", e)
  },
  tttt(e) {
      console.log("tttt", e)
  }
})
